from fastapi import Depends

from overrides import override
import typing as T

from ..UserHistoryService import UserHistoryService as _UserHistoryService
from ...mapper.UserHistoryMapper import UserHistoryMapper, _UserHistoryMapper


class UserHistoryServiceImpl(_UserHistoryService):
    mapper: _UserHistoryMapper = None

    def __call__(self, mapper: UserHistoryMapper):
        self.mapper = mapper
        return self

    @override
    async def getChatHistory(self, sessionId: int, count: int):
        return await self.mapper.getChatHistory(sessionId, count)


UserHistoryService = T.Annotated[
    UserHistoryServiceImpl, Depends(UserHistoryServiceImpl())
]
